#include <stdio.h>

void quick_sort(int *my_array, int low, int high);
int main(int argc, char const *argv[]){
    int my_array[10] = {1, 9, 45, 7, 15, -5, 2, 74, -27, 10};
    int my_array_length = sizeof(my_array)/sizeof(my_array[0]);
    quick_sort(my_array, 0, my_array_length-1);
    for (int i = 0; i < my_array_length; i++)
        printf("%d ", my_array[i]);
    printf("\n");
    return 0;
}

void quick_sort(int *my_array, int low, int high){
    if(low < high){
        int left = low, right = high;
        int pivot = my_array[low];
        while(left < right){
            while(left < right && my_array[right] >= pivot)
                right--;
            if(left < right)
                my_array[left++] = my_array[right];
            while(left < right && my_array[left] < pivot)
                left++;
            if(left < right)
                my_array[right--] = my_array[left];
        }
        my_array[left] = pivot;
        quick_sort(my_array, low, left-1);
        quick_sort(my_array, right+1, high);
    }
}